-
Notifications
You must be signed in to change notification settings - Fork 4
update tests #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update tests #10
Conversation
@dzencot линтер упал. |
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dzencot эта штука повторяется неск раз. Ее можно вынести в общий модуль?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У нас это уже выделено отдельно
const expectOutput = async (expected, run = (f) => f()) => { |
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls[0]?.[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А в чем отличие от const firstArg = consoleLogSpy.mock.calls.join('\n');
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь берем именно что было передано в первый вызов console.log. при чем получаем не строковое значение, а тот тип, который был передан
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
окей, понял, вижу что в хелоу ворлде так сделано
@dzencot а чего jest не заменяешь в тестах, где надо проверить фуункции? |
No description provided.